#region Copyright(c) 2006 ZO, All right reserved.
// -----------------------------------------------------------------------------
// Copyright(c) 2006 ZO, All right reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   1.  Redistribution of source code must retain the above copyright notice,
//       this list of conditions and the following disclaimer.
//   2.  Redistribution in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//   3.  The name of the author may not be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
#endregion


#region Using directives

using ZO.SmartCore.Protocols.XMPP.SASL.Core;
using ZO.SmartCore.Protocols.XMPP.SASL.TLS;
using ZO.SmartCore.Xml;

#endregion

namespace ZO.SmartCore.Protocols.XMPP.Protocol.Common
{
    /// <summary>
    /// representing an entry in the stream:features list.
    /// </summary>
    public class StreamFeature : Element
    {

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="StreamFeature"/> class.
        /// </summary>
        public StreamFeature()
            : base("features", "", UriList.XmppStream, "stream")
        {
        }


        #endregion

        #region Destructor

        #endregion

        #region Fields

        #endregion

        #region Events

        #endregion

        #region Operators

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the mechanisms.
        /// </summary>
        /// <value>The mechanisms.</value>
        public Mechanisms Mechanisms
        {
            get
            {
                return (this.SelectSingleElement<Mechanisms>());
            }
            set
            {
                if (HasChildElement("mechanisms"))
                {
                    RemoveChildElement("mechanisms");
                }
                this.AddChild(value);
            }
        }

        /// <summary>
        /// Gets or sets the start TLS.
        /// </summary>
        /// <value>The start TLS.</value>
        public StartTLS StartTls
        {
            get
            {
                return (SelectSingleElement<StartTLS>());
            }
            set
            {
                if (HasChildElement("starttls"))
                {
                    RemoveChildElement("starttls");
                }
                this.AddChild(value);
            }
        }

        /// <summary>
        /// Gets a value indicating whether [supports start TLS].
        /// </summary>
        /// <value>
        /// 	<see langword="true"/> if [supports start TLS]; otherwise, <see langword="false"/>.
        /// </value>
        public bool SupportsStartTls
        {
            get
            {
                if (this.StartTls == null)
                {
                    return false;
                }
                return true;
            }
        }

        /// <summary>
        /// Gets a value indicating whether [supports mechanisms].
        /// </summary>
        /// <value>
        /// 	<see langword="true"/> if [supports mechanisms]; otherwise, <see langword="false"/>.
        /// </value>
        public bool SupportsMechanisms
        {
            get
            {
                if (this.Mechanisms == null)
                {
                    return false;
                }
                return true;
            }
        }
 


        #endregion

        #region Methods


        #endregion
    }
}
